package com.willian.andrappfw.network;

import android.app.Dialog;
import androidx.annotation.NonNull;
import com.willian.andrappfw.utils.WDialogBuilder;

public abstract class Callback<T> {
    private Dialog dialog;

    public Callback() { }

    public void onStart() {
        if (this.dialog != null) {
            this.dialog.show();
        }
    }

    public void onEnd() {
        if (this.dialog != null && this.dialog.isShowing()) {
            WDialogBuilder.dismissDialog(this.dialog);
        }

    }

    public abstract void onSuccess(T var1);

    public abstract void onError(Throwable var1);

    void setProgressDialog(@NonNull Dialog dialog) {
        this.dialog = dialog;
    }
}
